package com.itlong.cloud.tapd.controller;//package com.example.test.tapd.controller;

import com.itlong.cloud.tapd.service.CompletedWorkOrdersNumberService;
import com.itlong.cloud.tapd.service.TotalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

//
//import com.example.test.tapd.common.POJO.WorkOrderNoticeVO;
//import com.example.test.tapd.service.CompletedWorkOrdersNumberService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import java.text.ParseException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//
///**
// * <des>
// *
// * <des>
// *
// * @create Date 2021-09-07
// **/
@RestController
public class TestController {


    CompletedWorkOrdersNumberService service = new CompletedWorkOrdersNumberService();
    TotalService totalService = new TotalService();
    List<String> workspaceidList = totalService.getWorkspaceidList();
    @RequestMapping("/test1")
    public HashMap<String, Integer> getTasksDoneCount() throws ParseException {
           return service.getTasksDoneCount(totalService.getUserList(),workspaceidList);
    }

    @RequestMapping("/test2")
    public HashMap<String, Integer> getToDoCount() throws ParseException {
        return service.getTasksToDoCount(totalService.getUserList(),workspaceidList);
    }

    @RequestMapping("/test3")
    public HashMap<String, Integer> getToCount() throws ParseException {
        return service.getTasksNotFinishedCount(totalService.getUserList(),workspaceidList);
    }

    @RequestMapping("/test4")
    public HashMap<String,HashMap<String,String>> getMonthlyTasksDoneCount() throws ParseException {
        return service.getMonthlyTasksDoneCount(totalService.getUserList(),workspaceidList);
    }

    @RequestMapping("/test5")
    public Map<String,Object> getTotalService() throws ParseException {
        return totalService.getDailyResults(totalService.getUserList(),totalService.getTasks(workspaceidList),totalService.getStories(workspaceidList),totalService.getBugs(workspaceidList));
    }

    @RequestMapping("/test6")
    public Map<String,Object> getMonthlyResults() throws ParseException {
        return totalService.getMonthlyResults(totalService.getUserList(),totalService.getTasks(workspaceidList),totalService.getStories(workspaceidList),totalService.getBugs(workspaceidList));
    }
}
